package cn.bigcontainer.alt.workflow.po;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import cn.bigcontainer.alt.common.entity.BigMap;
import cn.bigcontainer.alt.common.po.BasePo;
import cn.bigcontainer.alt.common.po.Po;
import cn.bigcontainer.alt.common.util.WoKit;
import cn.bigcontainer.alt.meta.typehandler.BigMapHandler;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 流程任务实例，记录每个任务提交的数据，也叫流程日志
 * @author cailei
 * @create_date 2011-3-13
 */
@Data
@TableName(autoResultMap = true)
@Accessors(chain = true)
public class MTaskInstance extends BasePo {

    @TableId(type = IdType.AUTO)
    protected Integer id;

	protected String name;

    /**
     * 流程定义id，MApp(type=workflow).id
     */
    protected String processDefinitionId;

    protected String processInstanceId;

    protected String taskDefinitionId;

	/**
     * 0-保存，1-提交，2-同意，3-拒绝并打回，4-拒绝并结束，5-转发
     */
	protected Integer operation = 0;

    /**
     * 执行人
     */
	protected String assigneeId;

    /**
     * taskDefinitionId对应MView提交的数据
     */
    @TableField(typeHandler = BigMapHandler.class)
    protected BigMap<String, Object> formValues = new BigMap<>();// text

    @TableField(typeHandler = BigMapHandler.class)
    protected BigMap<String, Object> data = new BigMap<>();// text

    /**
     * 创建时间
     */
    protected Date createTime;

    public MTaskInstance(Po po) {
        WoKit.cloneBySetter(po, this);
    }

    public MTaskInstance() {
    }
}
